<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<script src="../js/mui.js"></script>
		<script src="../js/storage.js"></script>
		<style>
			.mui-content {
				padding-left: 30px;
				padding-right: 30px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">服务地址设置</h1>
		</header>

		<div class="mui-content">

			<div class="mui-content-padded" style="margin-top: 60px;">
				<div class="mui-input-row mui-input-border" style="border: 0;">
					<input type="text" placeholder="请输入ip" id="ip"
						style="background-color: transparent;border: 0;border-bottom: 1px solid #ccc;">
				</div>
			</div>


			<div class="mui-content-padded">
				<button class="mui-btn mui-btn-green mui-btn-block" id="confirm" style="border-radius: 20px;">
					确定
				</button>
			</div>
		</div>

		<script type="text/javascript">
			let ip = localStorage.getItem("ip");
			document.querySelector("#ip").value = ip;
			mui.init()
			mui('body').on('tap', '#confirm', function() {
				var ip = document.querySelector("#ip").value;
				if(ip){
					let url = ip.indexOf('http://') == 0? ip : 'http://' + ip;
					localStorage.setItem("ip", url)
					mui.toast("保存成功")
				}
				mui.back()
			})
		</script>
	</body>

</html>